package com.koolearn.lms.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcDaoSupport;
import org.springframework.stereotype.Repository;

import javax.sql.DataSource;
import java.util.List;
import java.util.Map;

@SuppressWarnings("unchecked")
@Repository
public class BaseDao extends NamedParameterJdbcDaoSupport {

	@Autowired
	protected void setDatasource(DataSource dataSource) {
		super.setDataSource(dataSource);
	}

	public List<Map<String,Object>> find(String sql){
		return this.getJdbcTemplate().queryForList(sql);
	}
}
